package cglgu.trellis.chado.das2.modelimpl;

/*
 * $Id: ChadoType.java 191 2011-03-27 00:38:22Z sundaram.georgetown@gmail.com $
 * $Author: sundaram.georgetown@gmail.com $
 * $Date: 2011-03-27 00:38:22 +0000 (Sun, 27 Mar 2011) $
 * $Rev: 191 $
 * $HeadURL: http://genomancer.googlecode.com/svn/branches/gu-dev-branch/tengcha/src/cglgu/trellis/chado/das2/modelimpl/ChadoType.java $
 */

import genomancer.trellis.das2.model.Das2TypeI;
import cglgu.trellis.chado.das2.TrackType;
import genomancer.vine.das2.client.modelimpl.Das2Type;
import cglgu.trellis.chado.das2.cglgu.Analysis;
import java.net.URI;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;

public class ChadoType extends Das2Type implements Das2TypeI  {

	boolean initialized = false;

	ChadoVersion chado_version;

	public ChadoType(URI base_uri, ChadoVersion version, Analysis analysis) {

		String program = analysis.getProgram();
		String description = analysis.getDescription();


		super(base_uri,      // base_uri
				program,  	 // local_uri_string
				program, 	 // title
				description, // description
				null,        // info_url
				null,        // ontology_term_name (will get assigned ROOT_TYPE if null)
				null,        // method
				true);       // is_searchable

		chado_version = version;

		// do substitutions to get proper title
		// handling title here, to use grouping info
		String short_title = program;

		short_title = short_title.replace('/', ':');
		String fixed_title = short_title;

		this.setTitle(fixed_title);

		// handling description here
		this.setDescription(description);

		setTrackTableType(program);
	}

	public String getName() { return this.getLocalURIString(); }

	public TrackType getTrackType()  { return track_type; }

	protected void setTitle(String str)  {
		// setting title field inherited from genomancer.vine.das2.client.modelimpl.Das2CommonData
		//    (usually set in constructor, but needs modification for ChadoType)
		this.title = str;
	}

	protected void setDescription(String str)  {
		// setting description field inherited from genomancer.vine.das2.client.modelimpl.Das2CommonData
		//   (usually set in constructor, but needs modification for ChadoType)
		this.description = str;
	}

	public synchronized boolean initialize()  {
		boolean success = false;
		initialized = true;
		return success;
	}

}